module.exports = class extends think.Logic {
	createAction() {
		this.allowMethods = 'post';
		this.rules = {
			account: {string: true, required: true},
			name: {string: true, required: true},
			sex: {int: true, required: true},
			age: {int: true},
			status: {int: true},
			birthday: {date: true},
		};
	}

	deleteAction() {
		this.allowMethods = 'delete';
		this.rules = {
			id: {string: true, required: true, method: 'GET'}
		};
	}

	updateAction() {
		this.allowMethods = 'put';
		this.rules = {
			id: {string: true, required: true},
			account: {string: true, required: true},
			name: {string: true, required: true},
			sex: {int: true, required: true},
			age: {int: true},
			status: {int: true},
			birthday: {date: true},
		};
	}

	toggleStateAction() {
		this.allowMethods = 'put';
		this.rules = {
			id: {string: true, required: true},
			status: {int: true, required: true}
		};
	}

	resetPwdAction() {
		this.allowMethods = 'put';
		this.rules = {
			id: {string: true, required: true}
		};
	}

	modifyPwdAction() {
		this.allowMethods = 'put';
		this.rules = {
			id: {string: true, required: true},
			oldPwd: {string: true, required: true},
			newPwd: {string: true, required: true}
		}
	}

	getPageListAction() {
		this.allowMethods = 'get';
		this.rules = {
			searchKey: {regexp: /.*/, default: ''},
			currentPage: {int: true, default: 1, required: true},
			pageSize: {int: true, default: 5, required: true}
		};
	}

	getByIdAction() {
		this.allowMethods = 'get';
		this.rules = {
			id: {string: true, required: true}
		}
	}
};
